package com.hspedu.homework.homework13;

public class HomeWork13 {
    public static void main(String[] args) {

        Person[] persons = new Person[4];
        persons[0] = new Student("jack", '男', 18, 2022000001);
        persons[1] = new Student("smith", '女', 18, 2022000002);
        persons[2] = new Teacher("lisa", '女', 28, 10);
        persons[3] = new Teacher("rose", '女', 38, 20);

        for (int i = 0; i < persons.length; i++) {
            if (persons[i] instanceof Student) {
                ((Student)persons[i]).print();
            } else {
                ((Teacher)persons[i]).print();
            }

            System.out.println("-------------------");
        }
    }
}
